<?php
/*
	[UCenter Home] (C) 2007-2008 Comsenz Inc.
	$Id: site.php 10954 2009-03-02 05:26:27Z htom78 $
*/

include_once('./common.php');

//检查站点是否关闭
checkclose();

//处理rewrite
if($_SCONFIG['allowrewrite'] && isset($_GET['rewrite'])) {
	$rws = explode('-', $_GET['rewrite']);
	$_GET['ac'] = $rws[0];
	if(isset($rws[1])) {
		$rw_count = count($rws);
		for ($rw_i=1; $rw_i<$rw_count; $rw_i=$rw_i+2) {
			$_GET[$rws[$rw_i]] = empty($rws[$rw_i+1])?'':$rws[$rw_i+1];
		}
	}
	unset($_GET['rewrite']);
}

$ac = empty($_GET['ac'])?'index':trim($_GET['ac']);
$op = empty($_GET['op'])?'index':trim($_GET['op']);
$op_func = 'do_' . $op;

if (!function_exists($op_func)) {
   if(file_exists(S_ROOT.'./site/action/'.$ac.'.php')) {
      include_once(S_ROOT.'./site/action/'.$ac.'.php');
      if (function_exists($op_func)) {
        $op_func();
      } else {
        show404();
        exit;
      }
     //  include_once template("site/tpl/$ac");
      include_once template("site/tpl/$op");
      exit;
   } else {
    show404();
    exit;
   }
} else {
    die("fatal error:: please don't use the reserved function of $op");
    exit;
}


//include_once(S_ROOT.'./site/action/'.$ac.'.php');
//include_once template("site/tpl/$ac");

?>
